/**
 * Created by wlc on 2018/5/4.
 */
/**
 * 页面初始化
 */
$(document).ready(function(){
//        获取用户Cookis
    var user_infor_start = document.cookie.indexOf("ATTRMaterialDatabase_userInfor=")+"ATTRMaterialDatabase_userInfor=".length;
    var user_infor_end = document.cookie.indexOf(";",user_infor_start);
    if (user_infor_end===-1) {
        user_infor_end=document.cookie.length;
    }
//        显示用户id
    var i = 0;
    var user_ids = document.getElementsByClassName("user_id");
    for (i = 0; i < user_ids.length;i++){
        user_ids[i].innerText = unescape(document.cookie.substring(user_infor_start,user_infor_end)).split("wlcniubi")[0];
    }
//        显示用户名
    var user_names = document.getElementsByClassName("user_name");
    for (i = 0; i < user_names.length;i++){
        user_names[i].innerText = unescape(document.cookie.substring(user_infor_start,user_infor_end)).split("wlcniubi")[1];
    }
//        显示用户权限
    var user_authority = document.getElementsByClassName("authority-status");
    var authority_arr = unescape(document.cookie.substring(user_infor_start,user_infor_end)).split("wlcniubi")[2].split("");
    //数据权限
    for (i = 0; i < user_authority.length;i++){
        user_authority[i].innerText = dataAuthority_break(authority_arr[i]);
    }
//        获取用户消息条数
    $.ajax({
        type: 'GET',
        url: '../messageManager/getMessageNum',
        success: function (returndata) {
            $("#messageNum")[0].innerText = returndata;
        }
    });
});
